/**
 * 
 */
package com.jinmei.mail.response;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.codehaus.jettison.json.JSONException;

import com.jinmei.remote.response.BaseResponse;
import com.jinmei.remote.util.JSONUtils;


/**
 * @author richard
 *
 */
public class AllUserAccountsResponse extends BaseResponse {
	
	private static final String VER = "Ver";
	private static final String COUNT = "Count";
	private static final String LIST = "List";
	private static final String ALIAS = "Alias";
	
	private List<String> mailAccounts = new ArrayList<String>();
	
    public String getVer() {
        return getParam(VER);
    }
    
    public String getCount() {
        return getParam(COUNT);
    }
    
    public String getList() {
        return getParam(LIST);
    }
    
	public List<String> getMailAccounts() throws JSONException {
		List<Map<String, Object>> jsonlist = new ArrayList<Map<String, Object>>();
		jsonlist = JSONUtils.parseJSONArray(getList());
		
		for (Map<String, Object> params : jsonlist) {
			mailAccounts.add(String.valueOf(params.get(ALIAS)));
		}
		return mailAccounts;
	}

}
